nums = []
while True:
    num = int(input())
    if num == 0:
        break
    nums.append(num)

max_num = max(nums)
count = nums.count(max_num)

print(max_num)
print(count)